<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //作用域链
    //执行上下文：执行js代码的环境  栈：先进后出
    //闭包函数
    let a = 10; //全局变量
    function fn1(){
        let b = 'hello';
        function fn2(){
            let c= true;
            console.log(a); //10
            console.log(b); //hello
            console.log(c); //ture
        }
        fn2();
       // console.log('c:'+c); //报错 因为作用域链是往里面找
    }
    fn1();
</script>
</html>